%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ft=erlang ts=4 sw=4 et
OtpVersion = erlang:system_info(otp_release),
Config1 = case hd(OtpVersion) =:= $R andalso OtpVersion < "R15B02" of
              true  ->
                  HashDefine = [{d,old_hash}],
                  case lists:keysearch(erl_opts, 1, CONFIG) of
                      {value, {erl_opts, Opts}} ->
                          lists:keyreplace(erl_opts,1,CONFIG,{erl_opts,Opts++HashDefine});
                      false ->
                          CONFIG ++ [{erl_opts, HashDefine}]
                  end;
              false -> CONFIG
          end,
if
    OtpVersion >= "21" ->
        case lists:keysearch(erl_opts, 1, Config1) of
            {value, {erl_opts, Opts2}} ->
                lists:keyreplace(erl_opts, 1, Config1, {erl_opts, [{d, deprecate_stacktrace}|Opts2]});
            false ->
                [{erl_opts, [{d, deprecate_stacktrace}]}|Config1]
        end;
    true ->
        Config1
end.
